#include "basics.hpp"

#include <iostream>
#include <vector>

using namespace std;

int main() {
    cout << "... Part I, Basics ..." << endl;

    auto a = 13;
    auto b = 13.1;
    cout << "(a, b) : " << a << ", " << b << endl;
    cout << "cppt::max<int>(a, b) : " << cppt::max<int>(a, b) << endl;
    // set return type explicitly to double, and parameters' templates are deduced to type `int` and `double`.
    cout << "cppt::max<double>(a, b) : " << cppt::max<double>(a, b) << endl;
    cout << "cppt::ismax<double>(a, b) : " << cppt::ismax<double>(a, b) << endl;
    cout << "cppt::ismax2(a, b) : " << cppt::ismax2(a, b) << endl;

    auto c = new int;
    auto d = new int;
    *c = 13;
    *d = 14;
    cout << "(*c, *d) : " << *c << ", " << *d << endl;
    cppt::swap(c, d);
    cout << "After cppt::swap<int>(c, d), (*c, *d) : " << *c << ", " << *d << endl;

    auto m = string("Basics101");
    auto n = string("Exercise101");
    cout << "(m, n) : " << m << ", " << n << endl;
    cppt::swap(m, n);
    cout << "After cppt::swap(m, n), (m, n) : " << m << ", " << n << endl;
    auto v = vector<int>{1, 2, 3, 4};
    auto w = vector<int>{-1, -2, -3, -4};
    cout << "(v, w) : { ";
    for (auto i: v) cout << i << ' ';
    cout << "}, { ";
    for (auto i: w) cout << i << ' ';
    cout << "}" << endl;
    cppt::swap(v, w);
    cout << "After cppt::swap(v, w), (v, w) : { ";
    for (auto i: v) cout << i << ' ';
    cout << "}, { ";
    for (auto i: w) cout << i << ' ';
    cout << "}" << endl;


    return 0;
}
